"use client"; import { AreaChart } from "@/components/ui/charts"; import { EmptyState } from "@/components/ui/states"; import { fmtCompact, fmtMw } from "@/lib/format"; /** * Facilities by opening year (cumulative). Known MW is charted separately (own axis) only when the * market publishes any MW figure — never on a dual axis. */ export function GrowthChart({ data }: { data: Array<{ year: number; facilities: number; knownMw: number | null }> }) { const pts = [...data].filter((d) => Number.isFinite(d.year)).sort((a, b) => a.year - b.year); if (pts.length < 2) return ; const hasMw = pts.some((d) => d.knownMw !== null && d.knownMw > 0); return (
Facilities (cumulative)
({ x: d.year, y: d.facilities })), color: "var(--ink)" }]} height={170} format={(v) => fmtCompact(v, 0)} ariaLabel="Facilities by opening year" />
{hasMw && (
Known MW
({ x: d.year, y: d.knownMw })), color: "var(--accent)" }]} height={170} format={(v) => fmtMw(v)} ariaLabel="Known operational MW by opening year" />
)}
); }